package com.blb.thread;

/**
 * 自定义Runnable类
 */
//class MyRunnable implements Runnable{
//
//    @Override
//    public void run() {
//        System.out.println("Hello!" + Thread.currentThread().getName());
//    }
//}

public class Demo2Runnable {

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
//            //创建自定义线程对象，传入Runnable对象
//            Thread myThread = new Thread(new MyRunnable());
//            //启动线程
//            myThread.start();
            new Thread(() -> {
                    System.out.println("Hello!" + Thread.currentThread().getName());
            }).start();
        }
    }
}
